#include<iostream>
#include<vector>
#include<string>

using namespace std;

long long power(long long p, int b) {
	for(int i = 0; i < b - 1; ++i)
		p+=p<<5;
	return p;
}

long long get_H(string& str,long long p) {
	long long h = 0;
	int len = str.length();
	for(int i = 0; i < len; ++i)
		h = str[i] + h * p;
	return h;
}

void initPreH(string& t,long long p,vector<long long>& pre_H) {
	pre_H[0] = t[0]; // Inicialisation of pre_H.
	for(int i = 1; i < t.length(); ++i) {
		pre_H[i] = pre_H[i-1]*p + (long long)t[i];
	}
}

void initH(int lenS, int lenH, long long p, vector<long long>& pre_H, vector<long long>& H) {
	H[0] = pre_H[lenS-1]; //Inicialisation of H.
	for(int i = 1; i < lenH; ++i)
		H[i] = pre_H[i+lenS-1] - pre_H[i-1] * power(p,lenS);
}



int main() {
	string t, s;
	long long p = 33;
	long long sH; // H-function of little string.
	bool foundAnything = false; 

	getline(cin,t); // Main string.
	getline(cin,s); // Little string.

	sH = get_H(s,p);

	vector<long long> pre_H(t.length()); // Array of H-functions for prefixes.
	initPreH(t,p,pre_H);

	int lenH = (t.length() - s.length() + 1);
	vector<long long> H(lenH);  // Array of H-functions for string 't'.
	initH(s.length(),lenH,p,pre_H,H);
	
	
	for(int i = 0; i < lenH; ++i) { // Search of string s.
		if(H[i] == sH ) {
			bool equal = true;
			for(int j = i; j < i + s.length(); ++j)
				if(t[j] != s[j-i])
					equal = false;
			if (equal) {
				cout<<i<<' ';
				foundAnything = true;
			}
		}
	}

	if (!foundAnything)
		cout<<-1;

	cout<<endl;

	system("pause");
	return 0;
}